<?php        
$a = session_id();	if(empty($a)) session_start();
	//$root = dirname(dirname(dirname(dirname(dirname(__FILE__)))));		
	 $root = dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))));
	
	if (file_exists($root.'/wp-load.php')) {	
		require_once($root.'/wp-load.php');		
	}	
	

	
	$plugin_url_for_ajax = plugins_url('',  dirname(dirname(__FILE__)));		
	$plugin_base_ralative_path =  dirname(dirname(dirname(__FILE__)));	
	$base =  dirname(dirname(dirname(__FILE__)));	
	if (isset($_POST["STATUS"]) && $_POST["STATUS"] == "TXN_SUCCESS") {
		$transaction_id = $_REQUEST['TXNID'];
	$thankyou_url = get_option('moveto_thankyou_page');
				$thankyou_page_url = "";
				if($thankyou_url != '' && $thankyou_url != null){
					$thankyou_page_url = $thankyou_url;
				}else{
					$thankyou_page_url = "../../frontend/mp_thankyou.php";
				}
		   //echo 'Your Transaction ID : '.urldecode($payment_response_array["PAYMENTINFO_0_TRANSACTIONID"]);	
		 
		  ?>
		   <script src="../js/jquery-2.1.4.min.js" type="text/javascript"></script>
		   <script>
		   var dataString = <?php   echo $_SESSION['paytm_post_session']; ?>;
			function checkout_at_booking_complete(trans_id){
				dataString['payment_method'] = "paytm_payment";
				dataString['paytm_transaction_id'] = trans_id;
				
				jQuery.ajax({
					type:'POST',
					url:'mp_front_ajax.php',
					data: dataString,
					success:function(response){
						console.log(response);
							window.location.href='<?php echo $thankyou_page_url;?>';
					}
				});
			}
			checkout_at_booking_complete('<?php echo $transaction_id; ?>');
			</script>
			<?php 
	}
	?>